package com.wyj.rpc;

import com.wyj.rpc.config.RpcServer;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * TODO:
 *
 * @author wuyijie
 * @date 2021/12/26 12:07 下午
 */
@SpringBootApplication
public class ProviderApplication implements CommandLineRunner {
    private final RpcServer rpcServer;

    public ProviderApplication(RpcServer rpcServer) {
        this.rpcServer = rpcServer;
    }

    public static void main(String[] args) {
        SpringApplication.run(ProviderApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                rpcServer.startServer("127.0.0.1", 18082);
            }
        }).start();


    }
}
